<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_certificate" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="gotoPage('/mes/certificate/SearchCertificate?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 产品证书 </span>
      </div>
      <el-table :data="s_certificate">
        <el-table-column label="证书编号" prop="certificate_num">
        </el-table-column>
        <el-table-column label="认证类型" prop="setup_id">
        </el-table-column>
        <el-table-column label="证书类型" prop="certificate_type">
        </el-table-column>
        <el-table-column label="产品名称" prop="apply_product_id" width="40">
        </el-table-column>
        <el-table-column label="型号" prop="model_id" width="40">
        </el-table-column>
        <el-table-column label="规格" prop="norm_id" width="40">
        </el-table-column>
        <el-table-column label="申请人" prop="applicant_client">
        </el-table-column>
        <el-table-column label="制造商" prop="production_plant">
        </el-table-column>
        <el-table-column label="生产企业" prop="engin_client_id">
        </el-table-column>
      </el-table>
      <div class="form-unit">
        <span class="mvc-title-left"> 关键件证书 </span>
      </div>
      <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
      <el-table :data="pageList" v-loading="loading">
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="适用性" prop="part_relation">
          <template slot-scope="scope">
            {{getValueName("非全适用=1,全适用=2",scope.row.part_relation)}}
          </template>
        </el-table-column>
        <el-table-column label="类别" prop="part_type">
          <template slot-scope="scope">
            {{getValueName("A类=1,B类=2",scope.row.part_type)}}
          </template>
        </el-table-column>
        <el-table-column label="证书编号" prop="part_num">
        </el-table-column>
        <el-table-column label="关键件" prop="part_name">
        </el-table-column>
        <el-table-column label="关键件型号" prop="part_model">
        </el-table-column>
        <el-table-column label="关键件规格" prop="part_norm">
        </el-table-column>
        <el-table-column label="供应商" prop="client_name">
        </el-table-column>
        <el-table-column label="生产厂家" prop="enterprise">
        </el-table-column>
        <el-table-column label="增加时间" prop="entered">
          <template slot-scope="scope">
            {{getDateTimeString(scope.row,'entered')}}
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'SearchCertificateList',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_certificate: [],
        s_part: [],
        loading: true,
        pageList: [],
        pageSize: 10,
        total: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.getPage(1);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/certificate/CertificateAction/searchCertificateList?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      getPage(page) {
        this.loading = true;
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/certificate/CertificateAction/s_part?' + this.vueparams,
          params: {
            pageNo: page
          }
        }).then(data => {
          this.loading = false;
          this.pageList = data.rows;
          this.total = data.total;
        })
      },
    },
  }
</script>
